//package com.allan.springboot_wms.filter;
//
//import org.springframework.core.annotation.Order;
//
//import javax.servlet.*;
//import javax.servlet.annotation.WebFilter;
//import javax.servlet.http.HttpServletRequest;
//import java.io.IOException;
//
//@Order(1)
//@WebFilter(urlPatterns = {"/*"}, filterName = "routerFilter")
//public class RouterFilter implements Filter {
//
//    @Override
//    public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException {
//        HttpServletRequest request = (HttpServletRequest) req;
//        String servletPath = request.getServletPath();
//        String context = request.getContextPath();
//        //静态资源和接口一律放行
//        if (servletPath.matches("^.*(.js|.css|.font|.svg|.woff|.ttf|.ico)$") || servletPath.startsWith("/v1")) {
//            chain.doFilter(req, resp);
//        } else {//路由地址一律转发到index.html页面
//            req.getRequestDispatcher(context + "/index.html").forward(req, resp);
//        }
//    }
//
//}